Skip to content

[WPB-27169] Do not count apps and collaborators as members in get-team-size. - #5445

Draft
fisx wants to merge 16 commits into
developfrom
WPB-27169-do-not-count-apps-and-collaborators-as-members-in-get-team-size
Draft

[WPB-27169] Do not count apps and collaborators as members in get-team-size.#5445
fisx wants to merge 16 commits into
developfrom
WPB-27169-do-not-count-apps-and-collaborators-as-members-in-get-team-size

Conversation

@fisx

@fisx fisx commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

This is a follow-up to #5173, #5213, #5452, where we added data about number of apps and collaborators to the get-team-size response.

Changes:

  • The teamSize field works again as it did in the olden days, only counting team members, which are regular users by definition.
  • There are two more fields apps, collaborators, which contain the resp. counts.
  • Now all 3 counts add up to the legalhold limit, which is enforced correctly again.
  • The protobuf is also adjusted. I went for backwards-incompatible, because the change I undid was very recent, and has probably not been used. (I'll double-check this!)

https://wearezeta.atlassian.net/browse/WPB-27169

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Aug 13, 2026
@fisx
fisx force-pushed the WPB-27169-do-not-count-apps-and-collaborators-as-members-in-get-team-size branch from 9bbc19f to 5f5d7d0 Compare August 14, 2026 06:52
@fisx
fisx force-pushed the WPB-27169-do-not-count-apps-and-collaborators-as-members-in-get-team-size branch from 5f5d7d0 to 7c986b7 Compare August 26, 2026 14:58
@fisx
fisx marked this pull request as ready for review August 26, 2026 14:58
@fisx
fisx requested review from a team as code owners August 26, 2026 14:58
@fisx
fisx requested a lite review from Copilot August 26, 2026 14:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR (WPB-27169) changes the meaning/shape of “team size” so that API-visible teamSize represents paid seats (regular users) while apps and collaborators are reported separately, and propagates that change through Galley/Brig, the indexed user store, journaling, and tests.

Changes:

  • Redefines TeamSize to {teamSize, apps, collaborators} and updates JSON/OpenAPI schema plus golden fixtures.
  • Updates Galley/Brig logic and integration tests to treat apps/collaborators as non-members for get-team-size.
  • Extends indexed user store implementations and team journaling/protobuf definitions to carry separate app/collaborator counts.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
services/galley/src/Galley/API/Teams.hs Adjusts team-size bookkeeping and LegalHold-related checks to the new TeamSize shape.
services/galley/src/Galley/API/LegalHold/Team.hs Updates LegalHold activation size check to use the new TeamSize representation.
services/brig/test/integration/API/Team.hs Updates expected TeamSize JSON payload in Brig integration tests.
libs/wire-subsystems/test/unit/Wire/MockInterpreters/IndexedUserStore.hs Updates mock team-size computation and adds collaborator counting.
libs/wire-subsystems/src/Wire/UserSubsystem/Interpreter.hs Updates max-team-size checks to use teamSize (paid seats) only.
libs/wire-subsystems/src/Wire/TeamJournal.hs Updates journal event payload generation for new app/collaborator fields.
libs/wire-subsystems/src/Wire/IndexedUserStore/ElasticSearch.hs Updates ES-based team-size result mapping to the new TeamSize fields.
libs/wire-api/test/golden/testObject_TeamSize_1.json Refreshes golden JSON to new TeamSize schema.
libs/wire-api/test/golden/testObject_TeamSize_2.json Refreshes golden JSON to new TeamSize schema.
libs/wire-api/test/golden/testObject_TeamSize_3.json Refreshes golden JSON to new TeamSize schema (large-number case).
libs/wire-api/test/golden/testObject_Event_meeting_update_manual_1.json Golden fixture update (field ordering/structure adjustment).
libs/wire-api/test/golden/testObject_Event_meeting_member_add_manual_2.json Golden fixture update (field ordering/structure adjustment).
libs/wire-api/test/golden/testObject_Event_meeting_member_add_manual_1.json Golden fixture update (field ordering/structure adjustment).
libs/wire-api/test/golden/testObject_Event_meeting_delete_manual_1.json Golden fixture update (field ordering/structure adjustment).
libs/wire-api/test/golden/testObject_Event_meeting_create_manual_1.json Golden fixture update (field ordering/structure adjustment).
libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/TeamSize.hs Updates manual golden Haskell objects for TeamSize.
libs/wire-api/src/Wire/API/Team/Size.hs Redefines TeamSize and updates its schema/Arbitrary instance.
libs/types-common-journal/proto/TeamEvents.proto Changes TeamEvents event-data fields for app/collaborator counts.
integration/test/Test/TeamCollaborators.hs Adds integration assertion that collaborators are counted separately in team size.
integration/test/Test/Apps.hs Adds integration assertion that apps are counted separately in team size.
changelog.d/1-api-changes/WPB-27169-do-not-count-apps-and-collaborators-as-members-in-get-team-size Documents the API schema change for get-team-size and TeamEvents protobuf.
Suppressed comments (1)

services/galley/src/Galley/API/Teams.hs:1082

  • The LegalHold size check now sums teamSize + apps + collaborators here, but ensureNotTooLargeToActivateLegalHold (and the PR intent of “do not count apps/collaborators as members”) suggests only teamSize should be relevant. This inconsistency will make activation vs. later member/app changes apply different limits; please align the definition of what counts toward the LegalHold fanout size across all call sites.
    pure case uType of
      UserTypeFilterRegular -> n {teamSize = n.teamSize + 1}
      UserTypeFilterApp -> n {apps = n.apps + 1}
  ensureNotTooLargeForLegalHold tid (sizeAfterAdd.teamSize + sizeAfterAdd.apps + sizeAfterAdd.collaborators)

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread services/galley/src/Galley/API/Teams.hs
Comment thread services/galley/src/Galley/API/Teams.hs Outdated
Comment thread libs/wire-api/src/Wire/API/Team/Size.hs Outdated
Comment thread libs/types-common-journal/proto/TeamEvents.proto
Comment thread libs/wire-subsystems/src/Wire/IndexedUserStore/ElasticSearch.hs
Comment thread services/galley/src/Galley/API/Teams.hs Outdated
@@ -1,5 +1,5 @@
{
"teamSize": 0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it an intended breaking change?

@fisx
fisx requested a review from blackheaven August 27, 2026 09:36
@fisx
fisx force-pushed the WPB-27169-do-not-count-apps-and-collaborators-as-members-in-get-team-size branch from 6832456 to c9c245d Compare August 27, 2026 13:28
fisx and others added 16 commits August 27, 2026 15:41
Was previously UserSubsystem, but since it TeamCollaboratorsSubsystem
is also used outside of Brig, that is not always available.

Further changes:

- Support BrigAPIAccess locally in Brig.
- Change collaborator field type in UserDoc to collapse `Nothing` and
  `Just []` (remove the Maybe).
(I don't understand what it is about, and there is no author to ask.)
(This end-point only updates searchability settings, nothing else.)
This is only where we don't expect to use it.  if we're wrong about
this, a warning will be logged.
New schema: `{"teamSize": num, "apps": num, "collaborators": num}` (non-overlapping).
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@fisx
fisx force-pushed the WPB-27169-do-not-count-apps-and-collaborators-as-members-in-get-team-size branch from c9c245d to 7a33606 Compare August 27, 2026 14:07
@fisx
fisx marked this pull request as draft August 27, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants